package com.doudoukeji.service.Dialog;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.doudoukeji.service.Activity.ConstantValue;
import com.doudoukeji.service.Dialog.adapter.BaseDialog;
import com.doudoukeji.service.R;
import com.doudoukeji.service.Utils.LogUtil;


public class zqDialog extends BaseDialog {

    private onPositiveClickListener mOnPositeClickListener;
    private onCancleClickListener mCancleClickListener;
    private TextView mMessage;
    private Button positive;
    private Button back;

    public zqDialog(Context context) {
        super(context);
        setDialogContentView(R.layout.zqdialog);
        positive = (Button) findViewById(R.id.dialog_button_cancel);
        back = (Button) findViewById(R.id.dialog_button_ok);
        mMessage = (TextView) findViewById(R.id.message);
        back.setOnClickListener(this);
        positive.setOnClickListener(this);
        close_btn.setVisibility(View.GONE);
    }

    @Override
    public void onClick(View v) {
        super.onClick(v);

        switch (v.getId()) {
            case R.id.dialog_button_cancel:
                if (mOnPositeClickListener != null) {
                    mOnPositeClickListener.onPositiveClick();
                }
                this.dismiss();
                LogUtil.info("确定sing", ConstantValue.currentStage);
                break;
            case R.id.dialog_button_ok:
                if (mCancleClickListener != null) {
                    mCancleClickListener.onCancelClick();
                }
                LogUtil.info("返回sing", ConstantValue.currentStage);
                this.dismiss();
                break;

        }
    }

    public void setmessage(String message) {
        mMessage.setText(message);
    }

    public void setmessage(String message, float size) {
        mMessage.setTextSize(size);
        mMessage.setGravity(Gravity.CENTER);
        mMessage.setText(message);

    }

    public void setpositive(String message) {
        positive.setText(message);
    }

    public void setback(String message) {
        back.setText(message);
    }

    public interface onPositiveClickListener {
        public void onPositiveClick();

    }

    public interface onCancleClickListener {
        public void onCancelClick();

    }

    public void setmOnPositeClickListener(
            onPositiveClickListener onPositiveClickListener) {
        this.mOnPositeClickListener = onPositiveClickListener;
    }

    public void setOnCancelClickListener(
            onCancleClickListener onCancleClickListener) {
        this.mCancleClickListener = onCancleClickListener;
    }
}
